# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-multi_xml
_gemname=${pkgname#ruby-}
pkgver=0.7.1
pkgrel=0
pkgdesc="Swappable XML backends utilizing LibXML, Nokogiri, Ox, or REXML."
url="https://rubygems.org/gems/multi_xml"
arch="noarch"
license="MIT"
checkdepends="ruby-rake ruby-bundler ruby-rspec"
depends="ruby"
source="$pkgname-$pkgver.tar.gz::https://github.com/sferik/multi_xml/archive/refs/tags/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"
options="!check" #checks depend on rubocop, which is not currently packaged.

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake spec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc
}

sha512sums="
c578b6b4cadc48182ab94219d5f1550f645398c08460576cb5f6c72d8d6d01ef90b982437848d27e72f1157b9eff03dcafc29d04f298e52c14ae5b76df9082b0  ruby-multi_xml-0.7.1.tar.gz
a9543e60087b3385b38b39768e94bdff11f7b498972b96df4cc411430eb100c25eb81f991bed2ebb17a0e68883ca156be885fbbe5abd7ae11ab1e24ff3ceb425  gemspec.patch
"
